package cn.ggcms.cms.dao.impl;

import java.util.List;

import org.hibernate.criterion.Criterion;

import cn.ggcms.cms.dao.UsersDao;
import cn.ggcms.cms.utils.SimpleDao;
import cn.ggcms.cms.vo.Users;

public class UsersImpl extends SimpleDao<Users> implements UsersDao {

	public boolean doAddUser(Users users) {
		boolean flag=false;
		try {
			int id=super.save(users);
			if (id!=0) {
				flag=true;
			}else {
				flag=false;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flag;
	}

	public boolean doDeleteUser(int id) {
		boolean flag=false;
		try {
			super.delete(this.findUserById(id));
			flag=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flag;
	}

	public boolean doUpdateUser(Users users) {
		boolean flag=false;
		try {
			super.update(users);
			flag=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flag;
	}

	public List<Users> findUserAll() {
		return super.find(Users.class);
	}

	public Users findUserById(int id) {
		return super.get(Users.class, id);
	}

	public List<Users> findUserFuzzyAll(Users users) {
		
		return null ;	
	}
	public List<Users> findUserFuzzyAll(Criterion... criteria){
		return super.find(Users.class, criteria);
	}

	public List<Users> findUserFuzzyAll(String hql) {
		return super.find(hql);
	}
	
	
	
	
	
}
